package com.sniff.atp.modules.test.smallTool;

import com.alibaba.fastjson2.JSONObject;
import com.sniff.atp.utils.HttpClientUtil;
import com.sniff.atp.utils.JsonUtil;

/**
 * @ProjectName: sniff-atp
 * @Package: com.sniff.atp.modules.test.smallTool
 * @ClassName: UpdateSpecialMaterial
 * @Description: 批量更新特殊材质
 * @Author: zss
 * @CreateDate: 2024/1/15 10:26
 * @UpdateDate: 2024/1/15 10:26
 * @Version: 1.0
 */
public class UpdateSpecialMaterial {
    public static void main(String[] args) {

        String a = "SYSTEM24022901001164,SYSTEM24022901001165,SYSTEM24022901001166,SYSTEM24022901001167,SYSTEM24022901001168,SYSTEM24022901001169,SYSTEM24022901001170,SYSTEM24022901001171,SYSTEM24022901001172,SYSTEM24022901001173,SYSTEM24022901001174,SYSTEM24022901001175,SYSTEM24022901001176,SYSTEM24022901001177,SYSTEM24022901001178,SYSTEM24022901001179,SYSTEM24022901001180,SYSTEM24022901001181,SYSTEM24022901001182,SYSTEM24022901001183,SYSTEM24022901001184,SYSTEM24022901001185,SYSTEM24022901001186,SYSTEM24022901001187,SYSTEM24022901001188,SYSTEM24022901001189,SYSTEM24022901001190,SYSTEM24022901001191,SYSTEM24022901001192,SYSTEM24022901001193,SYSTEM24022901001194,SYSTEM24022901001195,SYSTEM24022901001196,SYSTEM24022901001197,SYSTEM24022901001198,SYSTEM24022901001199,SYSTEM24022901001200,SYSTEM24022901001201,SYSTEM24022901001202,SYSTEM24022901001203,SYSTEM24022901001204,SYSTEM24022901001205,SYSTEM24022901001206,SYSTEM24022901001207,SYSTEM24022901001208,SYSTEM24022901001209,SYSTEM24022901001210,SYSTEM24022901001211,SYSTEM24022901001212,SYSTEM24022901001213,SYSTEM24022901001214,SYSTEM24022901001215,SYSTEM24022901001216,SYSTEM24022901001217,SYSTEM24022901001218,SYSTEM24022901001219,SYSTEM24022901001220,SYSTEM24022901001221,SYSTEM24022901001222,SYSTEM24022901001223,SYSTEM24022901001224,SYSTEM24022901001225,SYSTEM24022901001226,SYSTEM24022901001227,SYSTEM24022901001228,SYSTEM24022901001229,SYSTEM24022901001230,SYSTEM24022901001231,SYSTEM24022901001232,SYSTEM24022901001233,SYSTEM24022901001234,SYSTEM24022901001235,SYSTEM24022901001236,SYSTEM24022901001237,SYSTEM24022901001238,SYSTEM24022901001239,SYSTEM24022901001240,SYSTEM24022901001241,SYSTEM24022901001242,SYSTEM24022901001243,SYSTEM24022901001244,SYSTEM24022901001245,SYSTEM24022901001246,SYSTEM24022901001247,SYSTEM24022901001248,SYSTEM24022901001249,SYSTEM24022901001250,SYSTEM24022901001251,SYSTEM24022901001252,SYSTEM24022901001253,SYSTEM24022901001254,SYSTEM24022901001255,SYSTEM24022901001256,SYSTEM24022901001257,SYSTEM24022901001258,SYSTEM24022901001259,SYSTEM24022901001260,SYSTEM24022901001261,SYSTEM24022901001262,SYSTEM24022901001263,SYSTEM24022901001264,SYSTEM24022901001265,SYSTEM24022901001266,SYSTEM24022901001267,SYSTEM24022901001268,SYSTEM24022901001269,SYSTEM24022901001270,SYSTEM24022901001271,SYSTEM24022901001272,SYSTEM24022901001273,SYSTEM24022901001274,SYSTEM24022901001275,SYSTEM24022901001276,SYSTEM24022901001277,SYSTEM24022901001278,SYSTEM24022901001279,SYSTEM24022901001280,SYSTEM24022901001281,SYSTEM24022901001282,SYSTEM24022901001283,SYSTEM24022901001284,SYSTEM24022901001285,SYSTEM24022901001286,SYSTEM24022901001287,SYSTEM24022901001288,SYSTEM24022901001289,SYSTEM24022901001290,SYSTEM24022901001291,SYSTEM24022901001292,SYSTEM24022901001293,SYSTEM24022901001294,SYSTEM24022901001295,SYSTEM24022901001296,SYSTEM24022901001297,SYSTEM24022901001298,SYSTEM24022901001299,SYSTEM24022901001300,SYSTEM24022901001301,SYSTEM24022901001302,SYSTEM24022901001303,SYSTEM24022901001304,SYSTEM24022901001305,SYSTEM24022901001306,SYSTEM24022901001307,SYSTEM24022901001308,SYSTEM24022901001309,SYSTEM24022901001310,SYSTEM24022901001311,SYSTEM24022901001312,SYSTEM24022901001313,SYSTEM24022901001314,SYSTEM24022901001315,SYSTEM24022901001316,SYSTEM24022901001317,SYSTEM24022901001318,SYSTEM24022901001319,SYSTEM24022901001320,SYSTEM24022901001321,SYSTEM24022901001322,SYSTEM24022901001323,SYSTEM24022901001324,SYSTEM24022901001325,SYSTEM24022901001326,SYSTEM24022901001327,SYSTEM24022901001328,SYSTEM24022901001329,SYSTEM24022901001330,SYSTEM24022901001331,SYSTEM24022901001332,SYSTEM24022901001333";

        String[] shopId = a.split(",");

        int lengthShop = shopId.length;
        int errorNumber= 0;
        String errorCode = "";
        for (int i = 0; i < lengthShop; i++) {

            System.out.println("---------------------" + i + "---------------------");
            JSONObject param = new JSONObject();
            param.put("specialCheckRequirement", "伊藤忠项目的重要客户，入库及质检如果发现商品有任何问题，都务必先联系业务，不要直接打次");
            param.put("specialCheckRequirementImg", "");
            param.put("systemOrderNo", shopId[i]);

            String result = new HttpClientUtil().doPostNeedToken("https://gateway-prod.theckb.com/order/manage/platformOrderItem/specialCheckEdit", param);
//        String result = new HttpClientUtil().doPostNeedToken("https://master-gateway.theckb.com/order/manage/platformOrderItem/specialCheckEdit", param);
            String code = JsonUtil.extractString(result, "code");
            if ("0".equals(code)) {

            } else {
                errorNumber ++;
                errorCode = errorCode.concat(shopId[i]);
                System.out.println("这个系统单号错了" + shopId[i]);
            }

            try {
                Thread.sleep(1000); // 1000毫秒 = 1秒
            } catch (InterruptedException e) {
                // 处理中断异常
            }

        }

        System.out.println("错误的次数"+ errorNumber);
        System.out.println("错误的"+ errorCode);
    }
}
